#!/bin/bash
##一键配置docker&k8s安装前环境配置
firewalld(){
	sudo systemctl stop firewalld
	sudo systemctl disable firewalld
	selinuxs
}
selinuxs(){
	setenforce 0
	if [[ -f "/etc/selinux/config" ]];then
		sudo sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config
	fi
	if [[ -f "/etc/sysconfig/selinux" ]];then
		sudo sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/sysconfig/selinux
	fi
	swaps
}
swaps(){
	sudo swapoff -a
	sudo sed -i '/swap/s/^\(.*\)$/#\1/g' /etc/fstab
	sysctls
}
sysctls(){
	sudo echo -e "net.bridge.bridge-nf-call-ip6tables = 1\nnet.bridge.bridge-nf-call-iptables = 1\nnet.ipv4.ip_forward = 1" > /etc/sysctl.conf
	sysctl -p
}
firewalld
